package cn.ecut.mapper;

import cn.ecut.model.User;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    User loginCheck(Map map);//验证用户登入
    void register(User user);//新用户注册
    @Update({"<script>",
            "update user",
            "  <set>",
            "    <if test='password != null'>password=#{password},</if>",
            "    <if test='userId != null'>userId=#{userId},</if>",
            "    <if test='sex != null'>sex=#{sex}</if>",
            "    <if test='birthday != null'>birthday=#{birthday},</if>",
            "    <if test='phoneNumber != null'>phoneNumber=#{phoneNumber}</if>",
            "    <if test='address != null'>address=#{address},</if>",
            "  </set>",
            "where username=#{username}",
            "</script>"})
    void updateUser(User user);//实现用户信息更新
    void updateUserInfo(User user);//用户自己个人修改信息
}